package interview;

import java.util.*;

public class test1 {
    static int sum = 0;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int n = sc.nextInt();
        dfs(m, n, 3);
        System.out.println(sum);

    }
    public static void dfs(int m, int n, int c){
        if(m == 0 && n == 0 && c == 0){
            sum++;
            return;
        }
        if(c < 0)
            return;
        if(n > 0)
            dfs(m, n - 1, c - 1);
        if(m > 0)
            dfs(m - 1, n, c * 2);
    }
}
